<script setup>
import {ref} from 'vue'
//声明一个学生数组
const stus = ref([
  {id: 1001,name: '小王',age:18},
  {id: 1002,name: '小健',age: 22},
  {id: 1003,name: '死羊',age: 20}])
const isLogin = ref(false)
</script>
<template>
  <table width="100%" border="1">
    <!--遍历数组-->
    <tr v-for="stu in stus">
      <td>{{stu.id}}</td>
      <td>{{stu.name}}</td>
      <td>{{stu.age}}</td>
    </tr>
  </table>
  <table width="100%" border="1">
    <!-- 使用索引 -->
    <tr v-for="(stu,index) in stus">
      <td>{{index + 1}}</td>
      <td>{{stu.id}}</td>
      <td>{{stu.name}}</td>
      <td>{{stu.age}}</td>
    </tr>
  </table>
</template>
<style scoped>
</style>